package com.kitty.action;

import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.kitty.entity.Foo;

public class InterceptController extends AbstractController {

	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		System.out.println(InterceptController.class + ",id="
				+ arg0.getParameter("d"));

		ModelAndView mav = new ModelAndView("interceptor");
		mav.addObject("interceptor", "interceptorValue");

		List<Foo> fooList = new ArrayList<Foo>();
		Foo first = new Foo();
		first.setId("23");
		first.setName("name");
		first.setPassword("password");
		fooList.add(first);

		Foo second = new Foo();
		second.setId("33");
		second.setName("name2");
		second.setPassword("password2");
		fooList.add(second);
		mav.addObject(fooList);

		return mav;
	}

}
